#ifndef _TYPEDEFS_H_
#define _TYPEDEFS_H_

#ifdef __cplusplus
extern "C" {
#endif

#include "main.h"


#define code const

#define NOP() __NOP()

//==================================================================================

// typedef uint32_t  u32;
// typedef uint16_t u16;
// typedef uint8_t  u8;
// //无符
 
// typedef int32_t  s32;
// typedef int16_t s16;
// typedef int8_t  s8;
//=================================================================================
#ifndef u8
#define u8  unsigned char
#endif

#ifndef u16
#define u16 unsigned short
#endif

#ifndef s16
#define s16 int16_t
#endif

#ifndef u32
#define u32 unsigned long
#endif

#ifndef U8
#define U8  unsigned char
#endif

#ifndef S8
#define S8  char
#endif

#ifndef U16
#define U16 unsigned short
#endif

#ifndef U32
#define U32 unsigned long
#endif

#ifndef BOOL
#define BOOL u8
#endif

#ifndef TRUE
#define TRUE (BOOL)SET
#endif

#ifndef FALSE
#define FALSE (BOOL)RESET
#endif

#define INFINITE 0xFFFFFFFF

//======================================================================
#define Bit0         0//
#define Bit1         1//
#define Bit2         2
#define Bit3         3
#define SetBit( Byte, Bit )  ( Byte ) |= ( 1<<( Bit ) )
#define ClrBit( Byte, Bit )  ( Byte ) &= ~( 1<<( Bit ) )
#define GetBit( Byte, Bit )  ( ( Byte ) & ( 1<<( Bit ) ) )
#define ComBit( Byte, Bit )  ( Bytes ) ^= ( 1<<( Bit ) )

#define BIT0         0x01
#define BIT1         0x02
#define BIT2         0x04
#define BIT3         0x08
#define SetBits( Byte, Bits ) ( Byte ) |= ( Bits )
#define ClrBits( Byte, Bits ) ( Byte ) &= ~( Bits )
#define GetBits( Byte, Bits ) ( ( Byte ) & ( Bits ) )
#define ComBits( Byte, Bits ) ( Byte ) ^= ( Bits )
//---------------------------------------------------------------------


#ifdef __cplusplus
}
#endif



#endif
